from sqlalchemy.orm import Session
from typing import List
from app.models.iaro_career.personal_eval import PersonalEvaluationResponse
from app.schema.personal_eval_schema import PersonalEvalCreate

def get_eval_by_scholar(db: Session, scholar_id: str) -> List[PersonalEvaluationResponse]:
    return db.query(PersonalEvaluationResponse).filter(PersonalEvaluationResponse.scholar_id == scholar_id).all()

def create_eval_response(db: Session, data: PersonalEvalCreate) -> PersonalEvaluationResponse:
    response = PersonalEvaluationResponse(**data.dict())
    db.add(response)
    db.commit()
    db.refresh(response)
    return response